import QQMapWX from '../libs/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.min.js'

const QQMap = new QQMapWX({
  key: '4SUBZ-5BIHI-6SLGE-UHP5Y-CCIBJ-PLFCL',
  // key: 'POEBZ-B2KW4-HJFU6-KBCZS-MIBYV-HSFRW',
})

QQMap.p = {
  // 路线规划
  direction(options) {
    return new Promise((resolve) => {
      QQMap.direction({
        ...options,
        success: resolve,
      })
    })
  },

  // 地点搜索
  search(options) {
    return new Promise((resolve) => {
      QQMap.search({
        ...options,
        success: resolve,
      })
    })
  },
  // 逆地址解析
  reverseGeocoder(options) {
    return new Promise((resolve) => {
      QQMap.reverseGeocoder({
        ...options,
        success: resolve,
      })
    })
  },
}

export default QQMap
